import java.util.Scanner;

public class Demo1 {
    public static boolean flg = false;

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            while (!flg){
                System.out.println("t1线程正在执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    System.out.println("t1线程被中断");
                }
            }
            System.out.println("t1线程停止");
        });
        t1.start();
        Scanner scanner = new Scanner(System.in);
        scanner.next();
        flg = true;
    }
}
